cmake_minimum_required(VERSION 3.20)

project(QtSqlTest)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)


set(QTVersion 5)

find_package(Qt${QTVersion}
        COMPONENTS
        Core
        REQUIRED
        Gui
        Widgets
        Sql
        )


include_directories(source/Model)
include_directories(source/Window)

include_directories("${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include")
file(GLOB_RECURSE   SRCS  RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}  LIST_DIRECTORIES false   source/*.cpp  source/*.ui)



if(CMAKE_BUILD_TYPE MATCHES "Debug")
    message("Debug Build")
    add_executable(${PROJECT_NAME}   ${SRCS} )
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
    message("Release Build")
    add_executable(${PROJECT_NAME} WIN32 ${SRCS})
endif()


target_link_libraries(${PROJECT_NAME} PRIVATE
        Qt::Core
        Qt::Gui
        Qt::Widgets
        Qt::Sql
        )